package LeetCode.LC48;

/**
 * @author corn
 * @create 2020-11-08-14:37
 */
public class Solution {
    public void rotate(int[][] matrix) {
        int n = matrix.length;
        //n/2：表示有多少个圈
        for(int i = 0; i < n / 2; i++){
            //每个圈中有多少四个点
            for(int j = i; j < n -1 - i ; j ++){
                //四点进行交换
                int temp = matrix[i][j];
                matrix[i][j] = matrix[n-j-1][i];
                matrix[n-j-1][i] = matrix[n-i-1][n-j-1];
                matrix[n-i-1][n-j-1] = matrix[j][n-i-1];
                matrix[j][n-i-1] = temp;
            }
        }
    }
}
